package.path = package.path ..';../?.lua'
local Linster = require('CSmsg/serverScoket')
local tool = require('lib/tool')

--TODO: chaos GameBaseModuleConworkFlow 2017年12月05日 星期二 15时19分16秒
--game init
--bind msgConnectMgr
--delegate or rewrite MsgConnectMgr func
    -- onReceive
    -- process

local ServerConnectMgr = tool.class('ServerConnectMgr', Linster)
function ServerConnectMgr:Ctor()

end

function ServerConnectMgr:onReceive(client, receive)
    local retTeleGram = self:parse(receive)
    assert(client:send( retTeleGram .. "\n"))
    print("Receive Client " .. self.dwConn .. " : ", receive)
end

function ServerConnectMgr:parse(receive)
    return "8155676"
end

local host =arg[1] or "127.0.0.1"
local port =arg[2] or "12345"
local timeout = arg[3] or 0
local linster = ServerConnectMgr:New()
linster:bind(host, port, timeout)
linster:runServer()
_G.game = {}
game.linster = linster
